#ifndef _DSWMEMLISTBASE_H
#define _DSWMEMLISTBASE_H
#include "dswbase.h"

typedef std::list<void*> LIST_VOID_MEM_T, *LPLIST_VOID_MEM_T;

typedef struct{
	pthread_mutex_t lock;
	LIST_VOID_MEM_T list;
	unsigned int seq;
} ST_LIST_MEM_T, *LPST_LIST_MEM_T;

typedef enum{
	TYPE_AUDIO_FRAME,
	TYPE_VIDEO_FRAME,
} EN_FRAME_TYPE;

class CDswmemlistbase : public CDswbase
{
public:
	CDswmemlistbase(LPST_ENV_T pEnv);
	virtual ~CDswmemlistbase();
protected:
	int GetNodeCount(LPST_LIST_MEM_T pList);
	void PutNodeToList(void* pNode, LPST_LIST_MEM_T pList);
	void PutNodeToListFront(void* pNode, LPST_LIST_MEM_T pList);
	void* GetNodeFromList(LPST_LIST_MEM_T pList);
	bool CopyNodeFromList(LPST_LIST_MEM_T pList, void* pDest, EN_FRAME_TYPE nType);
	virtual bool DumpFrame(void* pSrc, void* pDest){return false;};
protected:
	ST_LIST_MEM_T m_nUnUsed[MAX_CHANNEL_LOCAL * MAX_V_BITSTREAM_NUM];
	ST_LIST_MEM_T m_nUsed[MAX_CHANNEL_LOCAL * MAX_V_BITSTREAM_NUM];
};
#endif

